// pages/map/map.js
import {CrsClient} from "../scan/crsClient";
import {CryptoJS} from "../scan/CryptoJS";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showMap:true,
    showFloat:true,
    show:false,
    activeIndex:1,
    latitude:28.454862,
    longitude:117.943433,
    show3D:false,
    map:null,
    activeIndex:0,
    tabs:[
      {
        name:"超市",
        pic:'/images/dao/new/cs.png',
        sepic:'/images/dao/new/csse.png'
      },
      {
        name:"餐饮",
        pic:'/images/dao/new/cy.png',
        sepic:'/images/dao/new/cyse.png'
      },
      {
        name:"打卡点",
        pic:'/images/dao/new/dkd.png',
        sepic:'/images/dao/new/dkdse.png'
      },
      {
        name:"公共厕所",
        pic:'/images/dao/new/ggcs.png',
        sepic:'/images/dao/new/ggcsse.png'
      },
      {
        name:"酒店",
        pic:'/images/dao/new/jd.png',
        sepic:'/images/dao/new/jdse.png'
      },
      {
        name:"停车场",
        pic:'/images/dao/new/tcc.png',
        sepic:'/images/dao/new/tccse.png'
      },
      {
        name:"医院",
        pic:'/images/dao/new/yy.png',
        sepic:'/images/dao/new/yyse.png'
      }
    ],
    markers:[
      {
								longitude: 117.943433,
								latitude: 28.454862,
								width: 80,
								height: 72,
                joinCluster:true,
                title:"五三路口",
                iconPath:"https://txcy.oss-cn-hangzhou.aliyuncs.com/label_3.png",
                // label:{
                //   content:"五三路口",
                // },
								customCallout: {
									anchorX: 0,
									anchorY: -5,
									display: "ALWAYS" //ALWAYS BYCLICK
								},
      }
    ]
  },

  

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  handleTab(e){
    let index = e.currentTarget.dataset.index;
    this.setData({
      activeIndex:index
    })
  },
  getCenter(){
    let mpCtx = wx.createMapContext('map')
    console.log(mpCtx,"地图对象")
    // 将地图中心移置当前定位点，此时需设置地图组件 show-location 为true。'2.8.0' 起支持将地图中心移动到指定位置。
    mpCtx.moveToLocation()
  },
  handleColl(){
    this.setData({
      show:true,
      showFloat:false
    })
  },

  handleHide(){
    this.setData({
      show:false,
      showFloat:true
    })
  },
  markertap(){
    console.log('点击标注')
    this.setData({
      showMap:false
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
   
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})